package com.msw.jcwapi.wb.wbdz.controller;


import com.msw.jcwapi.common.result.Result;
import com.msw.jcwapi.wb.wbdz.entity.Wbdz;
import com.msw.jcwapi.wb.wbdz.service.IWbdzService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author author
 * @since 2025-04-01
 */
@RestController
@RequestMapping("/wbdz")
public class WbdzController {

    @Autowired
    private IWbdzService wbdzService;


    //    查询工程id对应工程的全部底座类型
    @GetMapping("/list/{id}")
    public Result list(@PathVariable Integer id) {
        return Result.ok(wbdzService.listByProId(id));
    }

    //通过wbdzid删除该底座的信息
    @DeleteMapping("/delete/{id}")
    public Result delete(@PathVariable Integer id) {
        return Result.ok(wbdzService.deleteById(id));
    }

    //通过wbdzid查询该底座的全部信息
    @GetMapping("/listByWbdzId/{id}")
    public Result listByWbdzId(@PathVariable Integer id) {
        return Result.ok(wbdzService.listByWbdzId(id));
    }

    //编辑腕臂底座(通过id编辑)
    @PutMapping
    public Result update(@RequestBody Wbdz wbdz){
        return  Result.ok(wbdzService.update(wbdz));
    }

    //添加腕臂底座
    @PostMapping
    public Result save(@RequestBody Wbdz wbdz){
        return Result.ok(wbdzService.save(wbdz));
    }


}
